package com.shenmazong.servereduuser.controller;

import com.shenmazong.servereduuser.entity.TbPermission;
import com.shenmazong.servereduuser.service.TbPermissionService;
import com.shenmazong.utils.ResultResponse;
import com.shenmazong.vo.BatchChooseIdVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;

/**
 * @author GuanJiaHe
 * @version 1.0
 * @description TODO
 * @date 2021/9/22 19:46
 */
@Api(tags = {"权限表API接口"})
@Controller
@RequestMapping(value = "/permission")
public class TbPermissionController {
    @Autowired
    private TbPermissionService permissionService;

    @ApiOperation(value="增加权限", notes="增加权限", produces="application/json")
    @PostMapping("addPermission")
    public ResultResponse addPermission(@RequestBody TbPermission tbPermission){
        return permissionService.addPermission(tbPermission);
    }

    @DeleteMapping("deletePermission")
    public ResultResponse deletePermission(@RequestBody BatchChooseIdVo chooseIdVo){
        return permissionService.deletePermission(chooseIdVo);
    }



    @ApiOperation(value="获取权限信息", notes="获取权限信息", produces="application/json")
    @PostMapping(value = "/getOnePermission")
    public ResultResponse getOnePermission(@RequestBody TbPermission permission) {
        return permissionService.getOnePermission(permission);
    }

    @ApiOperation(value="修改权限信息", notes="修改权限信息", produces="application/json")
    @PostMapping(value = "/updatePermission")
    public ResultResponse updatePermission(@RequestBody TbPermission permission) {
        return permissionService.updatePermission(permission);
    }

}
